home *** CD-ROM | disk | FTP | other *** search
/ Adobe Graphics & Publishing SDK 1996 December / Adobe Graphics & Publishing SDK 1996 December.iso / mac / PageMaker 6.5 SDK Mac / SourceCode / Includes / CIImageAccess.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-11-18  |  6.6 KB  |  150 lines  |  [TEXT/CWIE]

  1. /***[f*****************************************************************
  2.  *    CImgAcc.h    -- image Object Access Interface. 
  3.  *
  4.  *    Copyright 1996 (c) Adobe Systems, Inc. All Rights Reserved
  5.  *
  6.  *    Public version
  7.  * $Revision:   1.4  $
  8.  *
  9.  *    
  10.  ***f]*****************************************************************/
  11.  
  12. #ifndef __CIMGACC_H
  13. #define __CIMGACC_H
  14.  
  15. typedef    struct    _PMImageObjAttr {
  16.     unsigned short    isIndexed        : 1;    // is indexed image ==> has color map
  17.     unsigned short    isHifi            : 1;    // is multi-ink image
  18.     unsigned short    hasAlpha        : 1;    // has alpha sample
  19.     unsigned short    isColorManaged    : 1;    // color managed image (with ICC profile)
  20.     unsigned short    isGray            : 1;    // is grayscale image
  21.     unsigned short    unused            : 11;
  22.     
  23.     unsigned short    photo;                    // photometric interpretation
  24.  
  25.     unsigned long    imageWidth;                // image width in pixel
  26.     unsigned long    imageLength;            // image height in pixel
  27.                                             // crop rect in image space dimension
  28.     unsigned long    startingCol;            // starting pix in row
  29.     unsigned long    nCols;                    // number of pixels
  30.     unsigned long    startingRow;            // starting scanned line
  31.     unsigned long    nRows;                    // number of scanned lines
  32.     
  33.     double            xRes;                    // x resolution in dpi
  34.     double            yRes;                    // y resolution in dpi
  35.  
  36.     char            pluginType[4];
  37.     char            mediaType[4];
  38. } PMImageObjAttr;
  39.  
  40. ////////////////////////////////////////////////////////////////////////
  41. //     IMAGEDATAOPTIONS
  42. //
  43. //    DESCRIPTION:
  44. //    These are options for accessing images pixel data:
  45. //
  46. //    kImageAttributeOnly    Setup image for attributes access only, i.e.
  47. //                        will not try to acces image pixel data. Use this
  48. //                        option whenever image pixel data access will not be
  49. //                        needed. This will speed up setup process.
  50. //                        If this is set then all option flags related to
  51. //                        actual image data format will be ignored.
  52. //    kKeepImageBitdepth    The pixel data returned will be in its original
  53. //                        bitdepth. The default is to expand data to 8-bit
  54. //                        samples. When data are expanded to 8-bit samples:
  55. //                        1. Contone data will be interpolated so that 0 is 
  56. //                           mapped to 0 and 15 is mapped to 255 for 4-bit data.
  57. //                        2. Indexed data kept their original values but data 
  58. //                           are returned as 8-bit samples.
  59. //    kNoAlphaSamples        Pixels with alpha samples will be munged. At this
  60. //                        point, only the first associated alpha sample is
  61. //                        supported. Unassociated data and undefined extra
  62. //                        samples are dropped when kNoAlphaSamples is set.
  63. //    kMonoAsBlackZero    All contone monochrome data are returned as
  64. //                        Black Zero, i.e. 0 means black and (1<<x - 1) is white,
  65. //                        where x is the original bitdepth.
  66. //    kBWAsGray            1-bit B&W data is returned as gray data. That is 0
  67. //                        is mapped to 0 and 1 is mapped to 255.
  68. //
  69. ////////////////////////////////////////////////////////////////////////
  70.  
  71. typedef    unsigned long    IMAGEDATAOPTIONS;
  72. #define    kUseStandardDisplay            (IMAGEDATAOPTIONS)(1<<0)
  73. #define    kImageAttributeOnly            (IMAGEDATAOPTIONS)(1<<1)
  74. #define    kKeepImageBitdepth            (IMAGEDATAOPTIONS)(1<<2)
  75. #define    kNoAlphaSamples                (IMAGEDATAOPTIONS)(1<<3)
  76. #define    kMonoAsBlackZero            (IMAGEDATAOPTIONS)(1<<4)
  77. #define    kBWAsGray                    (IMAGEDATAOPTIONS)(1<<5)
  78.  
  79. #ifdef __cplusplus
  80. class CIImageObject : public CIInterface
  81. {
  82. public:
  83.     virtual    ~CIImageObject() {};
  84.     
  85.     // Set up to do image object access.
  86.     virtual PMXErr Setup( PMOBJ_REC* pObjRec, unsigned long options ) = 0;
  87.     
  88.     // Make sure this is called when finished.
  89.     virtual void Finished() = 0;
  90.     
  91.     // Get image object attributes. Setup() must be called first.
  92.     virtual    PMXErr GetImageAttr( PMImageObjAttr* pImObjAttr ) = 0;
  93.     
  94.     // Set row data access options. The option flags defined above can be or'ed
  95.     // together.
  96.     virtual PMXErr SetImageRowDataOptions( unsigned long options ) = 0;
  97.  
  98.     // Get image bits per sample and sample per pixels
  99.     virtual    PMXErr GetImageBitDepth( short *pBPS, short *pSPP ) = 0;
  100.     
  101.     // Get image row pixel data according to the options set.
  102.     virtual PMXErr GetImageRowData( unsigned long startCol, unsigned long startRow,
  103.                             unsigned long nCols, unsigned long nRows, char *pBuffer, unsigned long rowOffset ) = 0;
  104.     
  105.     // Get image row pixel data by plane according to the options set
  106.     virtual PMXErr GetImageRowDataByPlane( short whichPlane, unsigned long startCol, unsigned long startRow,
  107.                             unsigned long nCols, unsigned long nRows, char *pBuffer, unsigned long rowOffset ) = 0;
  108.     
  109.     // Get image first alpha channel data according to the options set if relevant.
  110.     //    If the alpha samples are already munged, i.e. kNoAlphaSamples is set or
  111.     //    if image does not have any, then alpha samples will not be returned.
  112.     virtual PMXErr GetImageFirstAlphaSamples( unsigned long startCol, unsigned long startRow,
  113.                             unsigned long nCols, unsigned long nRows, char *pBuffer, unsigned long rowOffset ) = 0;
  114.  
  115.     // The following interfaces require two-pass calls.
  116.     // The first call to get the size. If size > 0, caller allocate buffer of size
  117.     // The second call with the allocated buffer will return the desired information.
  118.                
  119.     // Get image's instrinsic color map:
  120.     // 1. full color images, there is no color map so *pSize = 0.
  121.     // 2. indexed images, the color map.
  122.     // 3. grayscale images, grayscale ramp according to the photometric
  123.     //      interpretation and/or the setting of kMonoAsBlackZero.
  124.     // The color map returned in a TIFF style map where color entries are
  125.     // arranged as planar data. Each color component is a short.
  126.     virtual PMXErr GetImageColorMap( long *pSize, char *pColorMap ) = 0;
  127.     
  128.     // Get image's unflatten ICC profile if image is color managed.
  129.     // When image is not color managed, *pSize = 0;
  130.     virtual    PMXErr GetImageProfile( long *pSize, char *pProfile ) = 0;
  131.     
  132.     // Get image's instrinsic ink attributes (valid only for hifi image).
  133.     // If image is not a hifi image *pCount = 0, other *pCount indicate the number
  134.     // of inks.
  135.     // Each ink name is a fixed length of 255 chars.
  136.     virtual PMXErr GetImageIntrinsicInkAttr( long *pCount, char *pInkNames ) = 0;
  137.     
  138.     // Sets image's mediaType and pluginType fields.  The mediaType defines the type of media
  139.     // the image represents (ex: 'moov' for QuickTime movie).  The pluginType defines the
  140.     // preferred plugin for double-click editing of the media image (ex: 'QTFP' for QuickTime
  141.     // Media Plugin).
  142.     // To NOT set one of the types, pass in a null pointer.
  143.     // Therefore the mediaType and pluginType must be either null or a
  144.     // pointer to a 4-byte character array.
  145.     virtual PMXErr SetImageMediaAndPluginTypes( char *mediaType, char *pluginType ) = 0;
  146. };
  147.   
  148. #endif    // __cplusplus
  149. #endif    // __CIMGACC_H
  150.